package com.qtyx.nms.ui.activity

import android.graphics.Color
import android.util.Log
import androidx.recyclerview.widget.GridLayoutManager
import com.google.gson.Gson
import com.qtyx.nms.R
import com.qtyx.nms.mvp.model.bean.NurseBean
import com.qtyx.nms.ui.adapter.NurseBedAdapter
import com.qtyx.nms.ui.base.BaseActivity
import com.qtyx.nms.util.IntentKey
import kotlinx.android.synthetic.main.ac_nurse_bed_list.*

/**
 * 护理项床位列表
 */
class NurseBedListActivity: BaseActivity() {
    override fun getLayoutId()= R.layout.ac_nurse_bed_list

    override fun initData() {
        val data=intent.getSerializableExtra(IntentKey.nurseBedInfo) as NurseBean.Data
        val selectPosition=intent.getIntExtra(IntentKey.nurseBedSelectPosition,-1)
        tvNurseBedListName.text=data.nursprogName
        if(data.titleColor.isNotEmpty()){
            tvNurseBedListName.setTextColor(Color.parseColor(data.titleColor))
        }
        val list=data.sqlData
        if(list.isNotEmpty()){
            rvNurseBedList.layoutManager=GridLayoutManager(mContext,6)
            val adapter=NurseBedAdapter(mContext,list)
            adapter.selectPosition=selectPosition
            rvNurseBedList.adapter=adapter
        }

    }
}